package flc.ast.adapter;

import android.graphics.Color;
import android.view.View;

import androidx.annotation.NonNull;
import androidx.constraintlayout.utils.widget.ImageFilterView;

import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.stark.pmu.bean.FilterItem;

import flc.ast.R;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;
import stark.common.basic.adaptermutil.StkSingleSpanProvider;

public class MusicFilterAdapter extends StkProviderMultiAdapter<FilterItem> {


    public MusicFilterAdapter() {
        addItemProvider(new StkSingleSpanProvider<>(76));
        addItemProvider(new MusicFilterProvider());
    }

    private class MusicFilterProvider extends BaseItemProvider<FilterItem> {
        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_music_filter;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, FilterItem bean) {
            ImageFilterView view = baseViewHolder.getView(R.id.ivMusicFilterItemImg);
            view.setImageResource(bean.imgRes);
            if (bean.isSelected()) {
                baseViewHolder.getView(R.id.tvMusicFilterItemSel).setVisibility(View.VISIBLE);
            } else {
                baseViewHolder.getView(R.id.tvMusicFilterItemSel).setVisibility(View.INVISIBLE);
            }
        }
    }

}
